<?php

namespace plugin\ycMassage\utils;

use plugin\ycMassage\utils\sms\Aliyun;
use plugin\ycMassage\utils\sms\Smsbao;

class Sms
{
    public static function main($saas_appid, $mobile, $code)
    {
        $sms_channels = getHpConfig('sms_channels', $saas_appid, 'system');
        switch ($sms_channels) {
            case 'smsbao':
                return Smsbao::main($saas_appid, $mobile, $code);
            default:
                return Aliyun::main($saas_appid, $mobile, $code);
        }
    }
    public static function send($saas_appid, $mobile, $templateCode, $message, $data = [])
    {
        $sms_channels = getHpConfig('sms_channels', $saas_appid, 'system');
        switch ($sms_channels) {
            case 'smsbao':
                $message=MassageReplaceIndustryPersonnelName($saas_appid,$message);
                return Smsbao::send($saas_appid, $mobile, $message);
            default:
                if (empty($templateCode)) {
                    throw new \Exception('短信模板不能为空');
                }
                return Aliyun::send($saas_appid, $mobile, $templateCode, $data);
        }
    }
}
